<?php

defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view');

/**
 * View class 
 */
class TaxibookingViewRoutes extends JView {

	function display($tpl = null)
	{
		global $mainframe, $option;

		//initialise variables
		$user 		= & JFactory::getUser();
		$db  		= & JFactory::getDBO();
		$document	= & JFactory::getDocument();
		$lang 		= & JFactory::getLanguage();
		
		JHTML::_('behavior.tooltip');

		//get vars
//		$filter_order		= $mainframe->getUserStateFromRequest( $option.'.points.filter_order', 		'filter_order', 	'p.ordering', 'cmd' );
//		$filter_order_Dir	= $mainframe->getUserStateFromRequest( $option.'.points.filter_order_Dir',	'filter_order_Dir',	'', 'word' );
//		$filter_state 		= $mainframe->getUserStateFromRequest( $option.'.points.filter_state', 		'filter_state', 	'*', 'word' );
		$filter_state 		= $this->get('State');
//		$search 			= $mainframe->getUserStateFromRequest( $option.'.points.search', 			'search', 			'', 'string' );
		$search 			=$this->get('Search');
//		$search 			= $db->getEscaped( trim(JString::strtolower( $search ) ) );

		//add css and submenu to document
		$document->addStyleSheet('components/com_taxibooking/assets/css/bookingbackend.css');

		//Create Submenu
		JSubMenuHelper::addEntry( JText::_( 'HOME' ), 'index.php?option=com_taxibooking');
		JSubMenuHelper::addEntry( JText::_( 'ITEMS' ), 'index.php?option=com_taxibooking&view=orders');
                JSubMenuHelper::addEntry( JText::_( 'INTEREST_POINTS' ), 'index.php?option=com_taxibooking&view=points');
                JSubMenuHelper::addEntry( JText::_( 'ROUTES' ), 'index.php?option=com_taxibooking&view=routes', true);
                JSubMenuHelper::addEntry( JText::_( 'COUNTYS' ), 'index.php?option=com_taxibooking&view=countys');
                JSubMenuHelper::addEntry( JText::_( 'DISTRICTS' ), 'index.php?option=com_taxibooking&view=districts');
                JSubMenuHelper::addEntry( JText::_( 'SETTINGS' ), 'index.php?option=com_taxibooking&view=settings');

		//create the toolbar
		JToolBarHelper::title( JText::_( 'ROUTES' ), 'generic' );
		JToolBarHelper::addNew();
		JToolBarHelper::spacer();
		JToolBarHelper::editList();
		JToolBarHelper::spacer();
		JToolBarHelper::deleteList();

		//Get data from the model
		$rows      	= & $this->get( 'Data');
		$pageNav 	= & $this->get( 'Pagination' );
		
		$state[] = JHTML::_('select.option',  '', '- '. JText::_( 'Select State' ) .' -' );
		$state[] = JHTML::_('select.option',  'P', JText::_( 'PUBLISHED' ) );
		$state[] = JHTML::_('select.option',  'U', JText::_( 'UNPUBLISHED' ) );

		$lists['state'] = JHTML::_('select.genericlist',   $state, 'filter_state', 'class="inputbox" size="1" onchange="submitform( );"', 'value', 'text', $filter_state );
		
		// search filter
		$lists['search']= $search;

		// table ordering
		$lists['order_Dir'] = $filter_order_Dir;
		$lists['order'] = $filter_order;

		$ordering = ($lists['order'] == 'p.ordering');

		//assign data to template
		$this->assignRef('lists'      	, $lists);
		$this->assignRef('rows'      	, $rows);
		$this->assignRef('pageNav' 		, $pageNav);
		$this->assignRef('ordering'		, $ordering);
		$this->assignRef('user'			, $user);
		$this->assignRef('direction'	, $lang);

		parent::display($tpl);
	}
}
?>